<html>
    <head>

        <script type="text/javascript" src="../valyjs.js"></script>
        <script type="text/javascript" src="testRunner.js"></script>

        <script>
            var testVariable = 1;
            var testObject = {name : "Dejan", surname : "Fajfar"};
            function foo(){return true;}
            test({
                title : "valy.about.version is set to the template version" ,
                testMethod : function(){
                    return valy.about.version == "<%= @version %>"
                }
            });
            test({
                title : "valy.about.name is set to the correct value" ,
                testMethod : function(){
                    return valy.about.name == "ValyJs"
                }
            });
            test({
                title : "valy.about.homepage is set to the correct value" ,
                testMethod : function(){
                    return valy.about.homepage == "http://code.google.com/p/valjjs/"
                }
            });
            test({
                title : "valy.about.developer is set to the correct value" ,
                testMethod : function(){
                    return valy.about.developer == "Dejan FAJFAR"
                }
            });
            test({
                title : "valy.exists called with existing variable inscope" ,
                testMethod : function(){
                    valy.exists(testVariable)
                    return true;
                }
            });
            test({
                title : "valy.exists called with non existing variable inscope" ,
                testMethod : AssertThrows(function(){
                    valy.exists(fuckIfIKnow)
                    return true;
                }, typeof(ValyJsError))
            });
            test({
                title: "valy.exists called with object member that is actually declared",
                testMethod : function(){
                    valy.exists(testObject.name);
                    return true;
                }
            });
            test({
                title : "valy.executeIfExists: desired element exists and function works" ,
                testMethod : function(){
                    valy.executeIfExists({
                        elementId : "TestP",
                        func: function(element){
                            element.innerHTML = valy.about.version;
                        }
                    });
                    return true;
                }
            });
            test({
                title : "valy.exists called with existing function",
                testMethod : function(){
                    valy.exists(foo());
                    return true;
                }
            });
        </script>
    </head>
    <body onload=runTests("TestResults")>
        <div id="TestResults"></div>

        <p id="TestP"></p>
    </body>
</html>